#ifndef FACE_H
#define FACE_H

#include "halfEdge.h"
#include "loop.h"
#include "color.h"
#include "vector3d.h"
#include "vertex.h"
#include <vector>
#include <set>
#include <GL/glut.h>

class Object;

class Face{
    public:
        Face(int = 0, Object * = NULL, Loop * = NULL);
        ~Face();

        int getId() const {return id;};
        void setId(int _id) {id = _id;};

        bool isSelected() const {return selected;};
        void select(bool _b) {selected = _b;};

        Object *getObject() const {return object;};
        void setObject(Object *_o) {object = _o;};

        Loop *getOutLoop() const {return outLoop;};
        void setOutLoop(Loop *_l) {outLoop = _l;};

        unsigned int getInLoopsSize() const {return inLoops.size();};
        Loop *getInLoop(unsigned int _i) const {return inLoops[_i];};
        void addInLoop(Loop *_l) {inLoops.push_back(_l);};
        void removeLoop(Loop *_l);

        Vector3D normal() const;
        double area() const;

//        void translate(const Vector3D &);
        std::set<Vertex *> getVertices();
        void setColor(const Color &_color);
        void draw(bool, bool) const;

        void selectAdjacentVertex();
        void selectAdjacentEdge();
        void selectAdjacentFace();

    private:
        int id;
        bool selected;
        Object *object;
        Loop *outLoop;
        std::vector<Loop *> inLoops;

        GLUtesselator *tobj;
};

#endif
